﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using ADONETDataServicesExtension.Utils;

namespace ADONETDataServicesExtension.Providers
{
    public class ResourceContainer : FrameworkEncapsulatedType<object>
    {
        internal const string FrameworkTypeName = "System.Data.Services.Providers.ResourceContainer";

        public ResourceContainer(object resourceContainer)
            : base(resourceContainer)
        {
        }

        public void AddReadAuthorizationMethod(MethodInfo method)
        {
            ReflectionHelper.InvokeVoidMethod(FrameworkTypeName, "AddReadAuthorizationMethod", FrameworkObject, method);
        }

        public Type ElementType
        {
            get
            {
                return ReflectionHelper.GetProperty<Type>(FrameworkTypeName, "ElementType", FrameworkObject);
            }
        }

        public void AddWriteAuthorizationMethod(MethodInfo method)
        {
            ReflectionHelper.InvokeVoidMethod(FrameworkTypeName, "AddWriteAuthorizationMethod", FrameworkObject, method);
        }
    }
}
